<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Edit Set</title>
    </h:head>
    <h:body>
        <ui:include src="../header.xhtml"/>
        <hr/>
        <f:view>
            <h:panelGrid columns="2">
                <h:form>
                    <h:panelGrid columns="2">
                        <f:facet name="header">
                            <h:outputText value="Create/Edit"/>
                        </f:facet>
                        <h:outputLabel value="HomeTeamScore:" for="homeTeamScore" />
                        <h:inputText id="homeTeamScore" value="#{setManagedBean.set.homeTeamScore}" title="HomeTeamScore" />
                        <h:outputLabel value="AwayTeamScore:" for="awayTeamScore" />
                        <h:inputText id="awayTeamScore" value="#{setManagedBean.set.awayTeamScore}" title="AwayTeamScore" />
                        <h:column>
                            &nbsp;
                        </h:column>
                        <h:column>
                            <h:commandButton value="Save" action="#{setManagedBean.addSet}"/>
                            <h:commandButton type="reset" value="Reset"/>
                        </h:column>
                    </h:panelGrid>
                </h:form>
                <h:panelGrid>
                    <f:view>
                        <h:form>
                            <h:dataTable value="#{setManagedBean.set.games}" var="item">
                                <f:facet name="header">
                                    <h:outputText value="Games"/>
                                </f:facet>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Home Team Score"/>
                                    </f:facet>
                                    <h:outputText value="#{item.homeTeamScore}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="Away Team Score"/>
                                    </f:facet>
                                    <h:outputText value="#{item.awayTeamScore}"/>
                                </h:column>
                                <h:column>
                                    <h:commandLink value="Edit" action="#{setManagedBean.editGame(item)}"/>
                                </h:column>
                                <h:column>
                                    <h:commandLink value="Remove" action="#{setManagedBean.removeGame(item)}"/>
                                </h:column>
                            </h:dataTable>
                            <h:panelGrid columns="2">
                                <f:facet name="header">
                                    <h:outputText value="New Game"/>
                                </f:facet>
                                <h:outputText value="Home Team Score"/>
                                <h:inputText value="#{setManagedBean.newGame.homeTeamScore}"/>
                                <h:outputText value="Away Team Score"/>
                                <h:inputText value="#{setManagedBean.newGame.awayTeamScore}"/>
                                &nbsp;
                                <h:commandButton value="Add" action="#{setManagedBean.addGame}"/>
                            </h:panelGrid>
                        </h:form>
                    </f:view>
                </h:panelGrid>
            </h:panelGrid>
        </f:view>
    </h:body>
</html>

